package com.nbsaas.boot.shop.rest.convert;

import com.nbsaas.boot.shop.data.entity.ShopBannerPosition;
import com.nbsaas.boot.shop.api.domain.simple.ShopBannerPositionSimple;

import com.nbsaas.boot.rest.api.Converter;

/**
* 广告位-列表对象转换器
*/

public class ShopBannerPositionSimpleConvert implements Converter<ShopBannerPositionSimple, ShopBannerPosition> {




@Override
public ShopBannerPositionSimple convert(ShopBannerPosition source) {
    ShopBannerPositionSimple result = new ShopBannerPositionSimple();

                result.setTemplate(source.getTemplate());
                result.setNote(source.getNote());

               try {
                   if(source.getShop()!=null){
                       result.setShop(source.getShop().getId());
                   }
                } catch (Exception ignored) { }

                result.setName(source.getName());
                result.setWidth(source.getWidth());

                try {
                    if(source.getShop()!=null){
                        result.setShopName(source.getShop().getName());
                    }
                } catch (Exception ignored) { }

                result.setSortNum(source.getSortNum());
                result.setId(source.getId());
                result.setAddDate(source.getAddDate());
                result.setKey(source.getKey());
                result.setHeight(source.getHeight());
                result.setLastDate(source.getLastDate());


    return result;
}

}